package nc.ui.arap.service;

import java.util.Map;

import nc.ui.pub.ClientEnvironment;
import nc.vo.arap.pub.QryObjectVO;
import nc.vo.arap.service.ServiceVO;
import nc.vo.pub.BusinessException;

public class QryObjCall  extends AbstractCall{

	public QryObjCall(String node) {
		
		super(null);
		
		this.node=node;
		
	}

	public ServiceVO getServcallVO() {
		
		
		Object obj = nc.ui.pub.ClientEnvironment.getInstance().getValue("arap_" + getNode() + "_" + getPk_corp());
		
		if(obj==null){
			callvo=new ServiceVO();
			callvo.setClassname("nc.itf.arap.pub.IArapQueryDocInfoPublic");
			callvo.setMethodname("getQryObj");
			callvo.setParamtype(new Class[] {String.class,String.class});
			callvo.setParam(new Object[] {getNode(), getPk_corp()});
			return callvo;
		}else{
			return null;
		}
	}
	
	public static String getPk_corp() {
		 return ClientEnvironment.getInstance().getCorporation().getPk_corp();
	}
	
	private String node;

	public void handleResult(Map<String, Object> datas)throws BusinessException  {
		
		if(callvo!=null){
			
			QryObjectVO[] object = (QryObjectVO[]) datas.get(callvo.getCode());
		
			nc.ui.pub.ClientEnvironment.getInstance().putValue("arap_" + getNode() + "_" + getPk_corp(),object);
		}
		
	}

	public String getNode() {
		return node;
	}

	public void setNode(String node) {
		this.node = node;
	}

}
